#ifndef __ATLASLOADER_H__
#define __ATLASLOADER_H__

#include "cocos2d.h"

using namespace cocos2d;
using namespace std;

typedef struct _atlas {
	char name[255];
	int width;
	int height;
	Point start;
	Point end;
} Atlas;

class AtlasLoader
{
public:

	/*
	 *	Get the instance of AtlasLoader
	 */
	static AtlasLoader* getInstance();

	/*
	 * Destroy the instance of AtlasLoader
	 */
	static void destroyInstance();

	/*
	 * Load the atlas of file
	 */
	void loadAtlas(string fileName);

	/*
	 * Load the atlas of file
	 */
	void loadAtlas(string fileName, Texture2D *texture);

	/*
	 * Get the sprite by name
	 */
	SpriteFrame* getSpriteFrameByName(string name);

private:
	AtlasLoader();

	/*
	 * Initializes the instance of AtlasLoader
	 */
	virtual bool Init();

	/*
	 * The singleton pointer of AtlasLoader
	 */
	static AtlasLoader* sharedAtlasLoader;

	/*
	 * container to share all the sprite frame that already loader.
	 */
	Map<std::string, SpriteFrame*> __spriteFrames;
};

#endif /* __ATLASLOADER_H__ */